package test5.stu

import scala.beans.BeanProperty


case class Student1(@BeanProperty var name: String, var age: Int) {
//  var name = n;
  ////  var age = a;

  def this(n: String) {
    this(n, 0)
  }

  def this() {
    this(null, 0)
  }

  def +(that: Int): Unit = {
    this.age += that
    println("this age="+this.age)
  }
  def >>(x:Int): Unit = {
    this.age += x
  }
  def ++(): Unit = {
    this.age +=1
  }
  def -(that: Int): Unit = {
    this.age -= that
  }

//  def +(t: Student1): Student1 = {
//    val stu = Student1(this.name + t.name, this.age + t.age)
//    return stu
//  }

  def show(): Unit = {
    println(s"这个学生名叫$name,年龄是$age")
  }

  def inc(): Unit = {
    age += 1
  }
}